import {Node} from './defined.js'
export function find(item){
    let currNode = this.head
    while(currNode.element!==item&&currNode!==null){
        currNode=currNode.next;
    }
    return currNode
}
//插入节点
export function insert(newElement,item){
    var newNode = new Node(newElement)
    var currNode=find(item)
    //(后入)
    newNode.next=currNode.next
    currNode.next=currNode

}

function findPre(item){
    var currNode = this.head
    while(currNode.next.element!==item&&current.next!=null){
        currNode=currNode.next
    }
    return currNode
}

export function remove(item){
    var preNode = findPre(item)
    preNode.next=preNode.next.next
} 

export function display(){
    var currNode = this.head
    while(currNode!==null){
        console.log(current.element);
        currNode=currNode.next
    }
    
}
